<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>用户登录</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/js/artDialog/skins/blue.css">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    
<script src="__PUBLIC__/Admin/bootstrap/js/jquery.min.js"></script>

<script src="__PUBLIC__/Admin/js/artDialog/artDialog.js"></script>
<script src="__PUBLIC__/Admin/js/artDialog/plugins/iframeTools.js"></script>
<script src="__PUBLIC__/Js/validform/Validform.js"></script>

<!-- Ajax用户登录 -->
<script> 
$(document).ready(function(e) {
	$(".regBox:eq(0)").Validform({
			ajaxPost:true,
			tiptype:function(data,s){
			},
			callback:function(data){
				//检测登录

				if(data.status == 0){
					error(data.info);

				}else{
					ClearForm('regBox');
					window.parent.dologin();
					art.dialog.close();
					art.dialog.data('submitForm').submitForm();
					//success(data.info);
					
					
				}
			}
	    });
    $(".loginBox:eq(0)").Validform({
			ajaxPost:true,
			tiptype:function(data,s){
				/*if(s.type == 1){
					$.ThinkBox.success(data,{'delayClose':0});
				}*/
			},
			callback:function(data){
				//检测登录
				if(data.status == 0){
					
					error(data.info);
				}else{
					ClearForm('loginBox');
					//处理
					window.parent.dologin();
					art.dialog.close();
					try{
					   art.dialog.data('submitForm').submitForm();
					}catch(e){
						
					}
					
				}
			}
	    });
});


function error(msg){
		var d = artDialog({
			title: '操作错误',
			content: msg,
			cancel: false,
			ok: function () {
			}
		});
		d.show();
	}
function success(msg){
    var d = artDialog({
        title: '操作成功',
        content: msg,
        cancel: false,
        ok: function () {
        }
    });
    d.show();
}
function ClearForm(id) {
    var objId = document.getElementById(id);
    if (objId == undefined) {
        return;
    }
    for (var i = 0; i < objId.elements.length; i++) {
        if (objId.elements[i].type == "text") {
            objId.elements[i].value = "";
        }
        else if (objId.elements[i].type == "password") {
            objId.elements[i].value = "";
        }
        else if (objId.elements[i].type == "radio") {
            objId.elements[i].checked = false;
        }
        else if (objId.elements[i].type == "checkbox") {
            objId.elements[i].checked = false;
        }
        else if (objId.elements[i].type == "select-one") {
            objId.elements[i].options[0].selected = true;
        }
        else if (objId.elements[i].type == "select-multiple") {
            for (var j = 0; j < objId.elements[i].options.length; j++) {
                objId.elements[i].options[j].selected = false;
            }
        }
        else if (objId.elements[i].type == "textarea") {
            objId.elements[i].value = "";
        }
        //else if (objId.elements[i].type == "file") {
        // //objId.elements[i].select();
        // //document.selection.clear();
        // // for IE, Opera, Safari, Chrome
        // var file = objId.elements[i];
        // if (file.outerHTML) {
        // file.outerHTML = file.outerHTML;
        // } else {
        // file.value = ""; // FF(包括3.5)
        // }
        //}
    }
}
</script>
  </head>
  <body>
  
  
  <style>
  .input-group{margin:8px}
  .nav-tabs>li{width:50%; text-align:center;}
  .btn{width:100% !important; display:block;}
  </style>
<div class="center" style="margin:0 auto;text-align:left;">

    
  <div>
    <ul id="myTab" class="nav nav-tabs">
       <li class="active">
          <a href="#home" data-toggle="tab">
             登录
          </a>
       </li>
       <li><a href="#ios" data-toggle="tab">注册</a></li>
    </ul>
  </div>

  <div id="myTabContent" class="tab-content container">
   
<div class="tab-pane fade in active" id="home"><form id="loginBox" method="post" action="<?php echo U('Member/Public/doLogin');?>" class="form-horizontal loginBox">
      <div class="input-group">
        <span class="input-group-addon" id="basic-addon1">用户:</span>
        <input type="text" class="form-control" name="username" placeholder="请输入用户名" aria-describedby="basic-addon1">
      </div>
      <div class="input-group">
        <span class="input-group-addon" id="basic-addon1">密码:</span>
        <input type="password" name="password" class="form-control" placeholder="请输入密码" aria-describedby="basic-addon1">
      </div>
      <div class="input-group" style="display:block;"><input type="reset" name="reset" style="display: none;" />
      <button type="submit" class="btn btn-success">登录</button>
      </div></form>
   </div>



   <div class="tab-pane fade" id="ios"><form id="regBox" method="post" action="<?php echo U('Member/Public/doReg');?>" class="form-horizontal regBox">
     <div class="input-group">
        <span class="input-group-addon" id="basic-addon1">昵　　称:</span>
        <input type="text" name="nickname" class="form-control" placeholder="请输入昵称" aria-describedby="basic-addon1">
      </div> <div class="input-group">
        <span class="input-group-addon" id="basic-addon1">用户名称:</span>
        <input type="text" name="username" class="form-control" placeholder="请输入用户名" aria-describedby="basic-addon1">
      </div>
      <div class="input-group">
        <span class="input-group-addon" id="basic-addon1">密　　码:</span>
        <input type="password" name="password" class="form-control" placeholder="请输入密码" aria-describedby="basic-addon1">
      </div>
      <div class="input-group">
        <span class="input-group-addon" id="basic-addon1">确定密码:</span>
        <input type="password" name="repassword" class="form-control" placeholder="请输入密码" aria-describedby="basic-addon1">
      </div>
      <div class="input-group" style="display:block;"><input type="reset" name="reset" style="display: none;" />
      <button type="submit" class="btn btn-success">注册</button>
      </div></form>
   </div>


  </div>

</div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="__PUBLIC__/Admin/bootstrap/js/bootstrap.min.js"></script>
  </body>
</html>